package com.zpark.controller;

import com.zpark.pojo.Student;
import com.zpark.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @RequestMapping("/find/{id}")
    public String find(@PathVariable Integer id, Model model){
        Student student = studentService.findOne(id);
        model.addAttribute("student", student);
        return "student/show";
    }
}
